<template>
	<view class="withholding">
		<u-navbar title="单品比价" title-color="#333" back-icon-color="#333"></u-navbar>
		<template>
			<view>
				<view class="uni-container">
					<uni-table border>
						<!-- 表头行 -->
						<uni-tr>
							<uni-th width="130">厂区</uni-th>
							<uni-th width="110">型号</uni-th>
							<uni-th width="80">价格</uni-th>
						</uni-tr>
						<!-- 表格数据行 -->
						<uni-tr v-for="(item,index) of tabList" :key="index">
							<uni-td>{{item.settb99CA00}}</uni-td>
							<div class="td-style-box" v-for="(item1,index1) of item.wl" :key="index1">
								<uni-td class="td-style">{{item1.settb109CA00}}</uni-td>
								<uni-td class="td-style">{{item1.settb109CA01}}</uni-td>
							</div>
						</uni-tr>
					</uni-table>
				</view>
			</view>
		</template>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userinfo: JSON.parse(uni.getStorageSync('userinfo')),
				discountList: [],
				discountYHList: [],
				discountListHF: [],
				rowspan: '3',
				tabList: [],
			}
		},
		onShow() {
			this.getDiscountDataHF()
			// if (this.ErpUserType == 'HF') {
			// 	this.getDiscountDataHF()
			// } else if (this.ErpUserType == 'FP') {
			// 	this.getDiscountDataFP()
			// }
		},
		methods: {
			getDiscountDataHF() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/set/settb109/selectSETTB109',
					method: 'POST',
					dataType: 'json',
					// data: {
					// 	ORMTB400ID: this.userinfo.ORMTB400ID, //一级客户ID
					// 	ORMTB410ID: this.userinfo.ORMTB410ID, //二级客户ID
					// },
					success: (res) => {
						console.log(res);
						if (res.data.code == 200) {
							this.tabList = res.data.data;
						} else {
							this.tabList = [];
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
						uni.hideLoading();
					},
					fail: (res) => {
						uni.hideLoading();
						uni.showToast({
							title: res.data.message,
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
			getDiscountDataFP() {
				uni.showLoading({
					title: '请求中...',
					mask: true
				});
				uni.request({
					url: this.baseUrl + '/orm/ormtb420/selectSettb400ByIdList',
					method: 'POST',
					dataType: 'json',
					data: {
						ORMTB400ID: this.userinfo.ORMTB400ID, //一级客户ID
					},
					success: (res) => {
						console.log(res);
						if (res.data.code == 200) {
							this.discountYHList = res.data.data.yhlist;
							this.discountList = res.data.data.list;
						} else {
							this.discountYHList = [];
							this.discountList = [];
							uni.showToast({
								title: res.data.message,
								duration: 5000,
								icon: 'none',
							});
						}
						uni.hideLoading();
					},
					fail: (res) => {
						uni.hideLoading();
						uni.showToast({
							title: res.data.message,
							duration: 5000,
							icon: 'none',
						});
					}
				});
			},
		}
	}
</script>

<style scoped>
	.withholding {
		width: 100%;
		/*  height: 100%;
	  position: fixed;
	  background: rgba(255, 255, 255, 1); */
		overflow-y: hidden;
	}

	.balanceWSJ {
		padding-top: 200rpx;
	}

	.balanceWSJ image {
		display: block;
		margin: 0 auto;
		height: 360rpx;
		width: 43%;
	}

	/* 内容 */
	.withholding-content {
		width: 100%;
		/* margin-top: 146rpx; */
	}

	.withholding-box {
		width: 100%;
		padding: 40rpx 24rpx 0;
		font-size: 0;
	}

	.withholding-box-one {
		width: 100%;
		display: flex;
		flex-direction: row;
		align-items: center;
	}

	.withholding-box-one>text:first-child {
		width: 30rpx;
		height: 30rpx;
		display: inline-block;
		border: 4rpx solid rgba(0, 161, 241, 1);
		border-radius: 50%;
	}

	.withholding-one-font {
		font-size: 26rpx;
		color: rgba(153, 153, 153, 1);
		margin-left: 20rpx;
	}

	.withholding-box-two1 {
		padding: 0rpx 0 30rpx 50rpx;

	}

	.withholding-box-two2 {
		/* padding-top: 30rpx; */
		/* padding: 0 0 30rpx 50rpx; */
		padding: 0 0 30rpx 0;
	}

	.withholding-box-two1>p {
		font-size: 26rpx;
		color: rgba(51, 51, 51, 1);
		text-indent: 2em;
	}

	.withholding-box-two2>text {
		font-size: 24rpx;
		color: rgba(51, 51, 51, 1);
	}

	.list-table {
		font-size: 24rpx;
		border: 1rpx solid #E8E8E8;
		margin-top: 20rpx;
	}

	.list-table-li {
		display: flex;
		flex-direction: row;
		align-items: center;
		text-align: center;
		line-height: 45rpx;
		border: 1rpx solid #E8E8E8;
		/* border-top:1rpx solid #E8E8E8 ;
		border-bottom:1rpx solid #E8E8E8 ; */
	}

	.list-table-li text:nth-child(2n) {
		/* border-top:1rpx solid #E8E8E8 ;
		border-bottom:1rpx solid #E8E8E8 ; */
	}

	.list-table-li text {
		flex: 1;
		border-left: 1rpx solid #E8E8E8;
		border-right: 1rpx solid #E8E8E8;
		padding: 20rpx 0;
	}

	.list-table-li text:first-child {
		background: rgba(232, 232, 232, .3);
		padding: 0 !important;

	}

	.uni-container {
		overflow-x: hidden;
		padding-bottom: 20px;
	}

	.uni-table-scroll {
		overflow-x: hidden;
	}

	.table--border {
		/* border: 2rpx solid #f7f7f7; */
	}

	.uni-table-th {
		background-color: cornflowerblue;
	}

	.th {
		text-align: center;
		/* color: #FFFFFF; */
		padding: 20rpx 0;
		font-weight: bolder;
		display: table-cell;
		border: 1px solid #f7f7f7
	}

	.td-style-box {
		width: 209%;
	}

	.td-style {
		width: 256rpx;
		/* text-align: center; */
		/* background: #FFFFFF; */
		/* padding: 20rpx 0; */
		/* display: table-cell; */
		/* border: 1px solid #f7f7f7 */
	}

	.uni-table-td {
		padding: 10rpx;
	}
</style>
